<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('业务流程影像上传登记列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <input type="hidden" name="stepId" id="stepId" th:value="${stepId}"/>
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <input type="hidden" name="versionId" id="versionId" th:value="${versionId}"/>
                        <input type="hidden" name="instanceId" id="instanceId" th:value="${instanceId}"/>

                        <li>
                            <label>档案编码：</label>
                            <input type="text" name="docCode"/>
                        </li>
                        <li>
                            <label>档案名称：</label>
                            <input type="text" name="docName"/>
                        </li>
                        <li>
                            <label>必传标志：</label>
                            <select name="isMust" class="selectpicker"
                                    th:with="type=${@dict.getType('common_yes_no')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="previewAll()">
                <i class="fa fa-eye"></i> 预览
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-doc-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var isMustDatas = [[${@dict.getType('common_yes_no')}]];
    var docTypeDatas = [[${@dict.getType('wfl_doc_type')}]];
    var prefix = ctx + "busiflw/docReg";

    $(function () {
        var options = {
            url: prefix + "/list",
            modalName: "业务流程影像上传登记",
            id: "bootstrap-doc-table",
            columns: [{
                checkbox: true
            },
                {
                    field: 'docRegId',
                    title: '档案编号',
                    visible: false
                },
                {
                    field: 'instanceId',
                    title: '实例号',
                    visible: false
                },
                {
                    field: 'docCode',
                    title: '档案编码',
                    align: "center"
                },
                {
                    field: 'docName',
                    title: '档案名称'
                },
                {
                    field: 'docType',
                    title: '档案类型',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(docTypeDatas, value);
                    }
                },
                {
                    field: 'docNums',
                    title: '文档数',
                    align: "right"
                },
                {
                    field: 'isMust',
                    title: '是否必传',
                    align: "center",
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(isMustDatas, value);
                    }
                },
                {
                    field: 'stepId',
                    title: '流程步骤',
                    visible: false
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-primary btn-xs " href="javascript:void(0)" onclick="preview(\'' + row.docRegId + '\')"><i class="fa fa-eye"></i> 预览</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });


    function preview(docRegId) {
        $.modal.open("附件预览", prefix + "/preview/" + docRegId, 700, 700);
    }

    function previewAll() {
        var instanceId = $("#instanceId").val();
        $.modal.open("全部附件预览", prefix + "/previewAll/" + instanceId, 900, 800);
    }
</script>
</body>
</html>